﻿using CTP.CRM.Repository.VSystemRepository.Entitys;
using System.Linq.Expressions;

namespace CTP.CRM.Repository.VSystemRepository.Services
{
    public interface IVSystemRepository
    {
        /// <summary>
        /// 查询系统id
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        VSystemEntity FirstOrDefault(Expression<Func<VSystemEntity, bool>> where);

        /// <summary>
        /// 根据条件获取单条
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        Task<VSystemEntity> GetSingleAsync(Expression<Func<VSystemEntity, bool>> where);

        /// <summary>
        /// 根据条件获取第一条
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        Task<VSystemEntity> GetFirstAsync(Expression<Func<VSystemEntity, bool>> where);

        /// <summary>
        /// 根据条件获取集合
        /// </summary>
        /// <param name="where">过滤条件</param>
        /// <returns></returns>
        Task<List<VSystemEntity>> GetListAsync(Expression<Func<VSystemEntity, bool>> where);

        /// <summary>
        /// 新增返回自增ID
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<int> InsertReturnIdentityAsync(VSystemEntity entity);

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<bool> UpdateAsync(VSystemEntity entity);

        /// <summary>
        /// 批量修改
        /// </summary>
        /// <param name="entities"></param>
        /// <returns></returns>
        Task<bool> UpdateRangeAsync(List<VSystemEntity> entities);

        /// <summary>
        /// 根据主键软删除（可批量）
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        Task<int> SoftDeleteAsync(params int[] ids);
    }
}